# -*- coding: utf-8 -*-

###########################################################################
# Python code generated with wxFormBuilder (version Sep  7 2018)
# http://www.wxformbuilder.org/
##
# PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################

import os
import sys
import wx
import wx.xrc

###########################################################################
# Class XMLtoExcelWindow
###########################################################################


class XMLtoExcelWindow (wx.Frame):

    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=title, pos=wx.DefaultPosition, size=wx.Size(1091, 559), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetIcon(wx.Icon(self.resource_path('excel.ico')))
        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        self.SetBackgroundColour(wx.Colour(255, 255, 255))

        self.MainMenuBar = wx.MenuBar(0)
        self.MenuHelp = wx.Menu()
        self.menuHelp = wx.MenuItem(self.MenuHelp, wx.ID_ANY, u"使用说明", wx.EmptyString, wx.ITEM_NORMAL)
        self.MenuHelp.Append(self.menuHelp)

        self.menuAbout = wx.MenuItem(self.MenuHelp, wx.ID_ANY, u"关于", wx.EmptyString, wx.ITEM_NORMAL)
        self.MenuHelp.Append(self.menuAbout)

        self.MainMenuBar.Append(self.MenuHelp, u"帮助")

        self.SetMenuBar(self.MainMenuBar)

        MainFrame = wx.BoxSizer(wx.HORIZONTAL)

        ManipulateArea = wx.BoxSizer(wx.VERTICAL)

        ManSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"包含 XML 文件的目录（支持拖放文件夹，不同目录以空行隔开）"), wx.VERTICAL)

        self.textFolderInput = wx.TextCtrl(ManSizer.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP | wx.TE_MULTILINE)
        ManSizer.Add(self.textFolderInput, 1, wx.ALL | wx.EXPAND, 5)

        ManipulateArea.Add(ManSizer, 1, wx.EXPAND, 5)

        OutPathSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.labelOutPath = wx.StaticText(self, wx.ID_ANY, u"Excel 文件输出目录", wx.DefaultPosition, wx.DefaultSize, 0)
        self.labelOutPath.Wrap(-1)

        OutPathSizer.Add(self.labelOutPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.textOutPath = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        OutPathSizer.Add(self.textOutPath, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        ManipulateArea.Add(OutPathSizer, 0, wx.EXPAND, 5)

        BtnSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.runButton = wx.Button(self, wx.ID_ANY, u"执行", wx.DefaultPosition, wx.DefaultSize, 0)
        BtnSizer.Add(self.runButton, 1, wx.ALL, 5)

        self.clearButton = wx.Button(self, wx.ID_ANY, u"清空", wx.DefaultPosition, wx.DefaultSize, 0)
        BtnSizer.Add(self.clearButton, 1, wx.ALL, 5)

        ManipulateArea.Add(BtnSizer, 0, wx.EXPAND, 5)

        MainFrame.Add(ManipulateArea, 1, wx.EXPAND, 5)

        LogArea = wx.BoxSizer(wx.VERTICAL)

        loggerSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"日志"), wx.VERTICAL)

        self.logOutput = wx.TextCtrl(loggerSizer.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP | wx.TE_MULTILINE | wx.TE_READONLY)
        loggerSizer.Add(self.logOutput, 1, wx.ALL | wx.EXPAND, 5)

        LogArea.Add(loggerSizer, 1, wx.EXPAND, 5)

        MainFrame.Add(LogArea, 1, wx.EXPAND, 5)

        self.SetSizer(MainFrame)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.Bind(wx.EVT_MENU, self.OnHelp, id=self.menuHelp.GetId())
        self.Bind(wx.EVT_MENU, self.OnAbout, id=self.menuAbout.GetId())
        self.runButton.Bind(wx.EVT_BUTTON, self.mergeFiles)
        self.clearButton.Bind(wx.EVT_BUTTON, self.clearText)

    def __del__(self):
        pass

    # Virtual event handlers, overide them in your derived class
    def OnHelp(self, event):
        event.Skip()

    def OnAbout(self, event):
        event.Skip()

    def mergeFiles(self, event):
        event.Skip()

    def clearText(self, event):
        event.Skip()

    def resource_path(self, relative_path):
        base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
        return os.path.join(base_path, relative_path)
